﻿package mortal.game.resource.tableConfig
{
    import Message.DB.Tables.*;
    import com.gengine.resource.*;
    import flash.utils.*;
    import mortal.game.view.common.*;

    public class GuildActivityConfig extends Object
    {
        private var _dic:Dictionary;
        private var _maxGuildActivity:int;
        private static var _instance:GuildActivityConfig;

        public function GuildActivityConfig()
        {
            this.write();
            return;
        }// end function

        private function write() : void
        {
            var _loc_2:Object = null;
            var _loc_3:TGuildActivityConfig = null;
            this._dic = new Dictionary();
            var _loc_1:* = ConfigManager.instance.getJSONByFileName("t_guild_activity_config.json");
            for each (_loc_2 in _loc_1)
            {
                
                _loc_3 = new TGuildActivityConfig();
                ClassTypesUtil.copyValue(_loc_3, _loc_2);
                this._dic[_loc_3.id] = _loc_3;
            }
            return;
        }// end function

        public function getItemById(param1:int) : TGuildActivityConfig
        {
            return this._dic[param1] as TGuildActivityConfig;
        }// end function

        public function get maxGuildActivity() : int
        {
            var _loc_1:TGuildActivityConfig = null;
            var _loc_2:int = 0;
            if (this._maxGuildActivity <= 0)
            {
                _loc_2 = 1;
                while (_loc_2 < int.MAX_VALUE)
                {
                    
                    _loc_1 = this.getItemById(_loc_2);
                    if (_loc_1 == null)
                    {
                        break;
                    }
                    this._maxGuildActivity = _loc_1.guildActivity;
                    _loc_2++;
                }
            }
            return this._maxGuildActivity;
        }// end function

        public static function get instance() : GuildActivityConfig
        {
            if (_instance == null)
            {
                _instance = new GuildActivityConfig;
            }
            return _instance;
        }// end function

    }
}
